package cn.edu.nwafu.hjpg.service.impl;


import cn.edu.nwafu.hjpg.dao.HyxxbDao;
import cn.edu.nwafu.hjpg.dao.StwhbDao;
import cn.edu.nwafu.hjpg.entity.Hjxwb;
import cn.edu.nwafu.hjpg.entity.Hyxxb;
import cn.edu.nwafu.hjpg.entity.Stwhb;
import cn.edu.nwafu.hjpg.service.HyxxbService;
import cn.edu.nwafu.hjpg.service.StwhbService;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.security.access.method.P;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StwhbServiceImpl implements StwhbService {

    final StwhbDao stwhbDao;

    public StwhbServiceImpl(StwhbDao stwhbDao){this.stwhbDao = stwhbDao;}

    @Override
    public List<Stwhb> findByIdAndFlagInStwhb(String id, String name,String flag) {return stwhbDao.findElementByBaseinfoWzbmAndAttributeAndFlag(id,name,flag);}

    @Override
    public Page<?> findAddRecordStwhb(String flag, Pageable pageable) { return stwhbDao.findAllByflag(flag,pageable);}

    @Override
    public String addupdateFlag(Stwhb stwhb) {return stwhbDao.save(stwhb).getId();}

    @Override
    public void deladdRecordstwhb(Stwhb stwhb) { stwhbDao.delete(stwhb);}

    @Override
    public String updateStwhb(Stwhb stwhb) {
        return stwhbDao.save(stwhb).getId();
    }

    @Override
    public String addHjwhfl(Stwhb stwhb) {
        return stwhbDao.insert(stwhb).getId();
    }

    @Override
    public String addYl(Stwhb stwhb) {
        return stwhbDao.insert(stwhb).getId();
    }

    @Override
    public String addSswjzsw(Stwhb stwhb) {
        return stwhbDao.insert(stwhb).getId();
    }

    @Override
    public String addZl(Stwhb stwhb) {
        return stwhbDao.insert(stwhb).getId();
    }

    @Override
    public String addSszw(Stwhb stwhb) {
        return stwhbDao.insert(stwhb).getId();
    }

    @Override
    public String addSswsw(Stwhb stwhb) {
        return stwhbDao.insert(stwhb).getId();
    }

    @Override
    public String addQtsssw(Stwhb stwhb) {
        return stwhbDao.insert(stwhb).getId();
    }

    @Override
    public String addDxsw(Stwhb stwhb) {
        return stwhbDao.insert(stwhb).getId();
    }

    @Override
    public String addLsjzsw(Stwhb stwhb) {
        return stwhbDao.insert(stwhb).getId();
    }

    @Override
    public String addLszw(Stwhb stwhb) {
        return stwhbDao.insert(stwhb).getId();
    }

    @Override
    public String addLstrsw(Stwhb stwhb) {
        return stwhbDao.insert(stwhb).getId();
    }

    @Override
    public String addLstrwsw(Stwhb stwhb) {
        return stwhbDao.insert(stwhb).getId();
    }

    @Override
    public String addNl(Stwhb stwhb) {
        return stwhbDao.insert(stwhb).getId();
    }

    @Override
    public String addQtlssw(Stwhb stwhb) {
        return stwhbDao.insert(stwhb).getId();
    }

    @Override
    public String addQtstdx(Stwhb stwhb) {
        return stwhbDao.insert(stwhb).getId();
    }

    @Override
    public String addElement(Stwhb stwhb) {
        return stwhbDao.insert(stwhb).getBaseinfoWzbm();
    }

    @Override
    public List<Stwhb> findAllByBaseinfoWzbmAndFlag(String id, String flag) {
        return  stwhbDao.findAllByBaseinfoWzbmAndFlag(id,flag);
    }

    @Override
    public Page<?> findByPageStwhb(String id,String attribute, int flag, Pageable pageable) {
        return stwhbDao.findAllByflagAndAttribute(id,attribute,flag,pageable);
    }



    @Override
    public List<Stwhb> findAll() { return stwhbDao.findAll();
    }
}